const Router = require("koa-router");
const templateRoute = new Router();
const { h } = require("snabbdom");
const toHTML = require("snabbdom-to-html");
const ReactDOMServer = require('react-dom/server');


templateRoute.get("/list/", async (ctx: any) => {
  const output = toHTML(
    h("div", { style: { color: "red" } }, [
      h("h1", "Test Demo1"),
      h("h1", "Test Demo1"),
      h("h1", "Test Demo2"),
    ])
  );
  const str = ReactDOMServer.renderToStaticMarkup()

  ctx.body = output;
});
templateRoute.post("/generate/", async (ctx: any) => {
  ctx.body = "Hello user create";
});

export { templateRoute };
